﻿using System;
using System.Collections.Generic;
using System.Text;
using GroupChat2013.Entity;

namespace GroupChat2013.Logic.Message
{
    /// <summary>
    /// 私聊天信息中的图片上传下载类
    /// </summary>
    public class UserImageUpload : AbstractImageUpload
    {
        private string friendId;

        public UserImageUpload(UserInfo userInfo, string friendId)
            : base(userInfo)
        {
            this.friendId = friendId;
        }

        /// <summary>
        /// 上传图片
        /// </summary>
        /// <param name="localUrl">图片本地路径</param>
        /// <returns></returns>
        public override string UpLoadImage(string localUrl)
        {
            return urlProxy.UploadUserChatImageURL(friendId, localUrl, m_UserInfo.CID);
        }

        /// <summary>
        /// 下载图片
        /// </summary>
        /// <param name="imageMD5Name">图片名字</param>
        /// <param name="savePath">保存图片的路径</param>
        public override void DownlodImage(string imageMD5Name, string savePath)
        {
            urlProxy.DownUserChatImage(m_UserInfo.CID, m_UserInfo.UserId, friendId, imageMD5Name, savePath);
        }
    }
}
